<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>事件委派</title>
  <script src="jquery-1.11.3.min.js"></script>
 </head>
 <body>
    <ul id="ul1">
	  <li>11111</li>
	  <li>22222</li>
	  <li>33333</li>
	  <li>44444</li>
	  <li>55555</li>
	</ul>
    <button id="btn1">添加新的li</button>
	<button id="btn2">移除事件委托</button>
 </body>
 <script>
    $("#ul1").delegate("li","click",function(){
	   $(this).css({"background-color":"red"});
	});


    $("#btn1").click(function(){
	    $("#ul1").append("<li>添加的新li标签</li>");
	});

	$("#btn2").click(function(){
	   $("#ul1").undelegate();
	});
 </script>
</html>
